<template>
  <div class="recommend">
    <!-- 为你推荐 -->
    <div class="title">
      <div class="title-top">
        <span>——</span>
        <span>为你推荐</span>
        <span>——</span>
      </div>
    </div>
    <!-- 介绍 -->
    <div class="rec-list">
      <div class="rec-item" v-for="item in recommendData" :key="item.id" @click="recomDetails(item)">
        <div class="img">
          <img :src="item.url" alt="" />
        </div>
        <div class="info">
          <p class="comName">{{ item.desc }}</p>
          <p class="price">
            ￥{{ item.price }}
            <img
              src="../../assets/images/al-icon-cart.png"
              alt=""
              class="iconImg"
            />
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "HomeRecommend",
  props:['recommendData'],
  data() {
    return {
      
    };
  },
  methods:{
    recomDetails(item){
      // console.log(item);
      this.$router.push({
        name:'RecomDetails',
        params:{
          id:item
        }
      })
    }
  },
  mounted() {
  },
 
};
</script>

<style lang="less" scoped>
.recommend {
  width: 100%;
  background-color: #eee;
  margin-bottom: 35px;
  .title {
    height: 35px;
    width: 100%;
    .title-top {
      width: 100%;
      height: 23px;
      line-height: 20px;
      color: rgba(153, 153, 153, 1);
      font-size: 14px;
      text-align: center;
    }
  }
  //   .rec-list:nth-child(2){

  //   }
  .rec-list {
    width: 100%;
    // height: 498px;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    padding: 36px 10px;
    box-sizing: border-box;
    background-color: #fff;

    .rec-item {
      flex: 1;
      width: 50%;
      height: 195px;
      margin-bottom: 36px;
      // padding: 36px 12px;
      // box-sizing: border-box;
      .img {
        width: 170px;
        height: 120px;
        margin: 0 auto 7px;
        img {
          width: 100%;
          height: 100%;
          border-radius: 8px;
        }
      }
      .info {
        padding: 10px;
        box-sizing: border-box;

        .comName {
          width: 150px;
          height: 41px;
          line-height: 20px;
          color: rgba(16, 16, 16, 1);
          font-size: 14px;
          text-align: left;
          font-family: Arial;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
        }
        .price {
          margin-top: 4px;
          width: 100%;
          height: 23px;
          line-height: 20px;
          color: rgba(111, 68, 138, 1);
          font-size: 14px;
          position: relative;
        }
      }
    }
  }
}
.iconImg {
  width: 30px;
  height: 30px;
  line-height: 20px;
  border-radius: 100px;
  background-color: rgba(255, 255, 255, 1);
  text-align: center;
  border: 1px solid rgba(245, 245, 245, 1);
  position: absolute;
  top: 0;
  right: 0;
}
</style>